import * as _ from "lodash-es"

export function should2boolean(assFunc: () => void, failDo?:(e:unknown) => void): boolean
{
    try
    {
        assFunc()
        return true
    }
    catch(e)
    {
        if(failDo) failDo(e)
        return false
    }
}

export function getErrorMsg(e: unknown)
{
    return _.get(e,"assertion.params.message") || _.get(e,"message") || ""
}